package com.apes.framework.plugin.todo;


import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TodoTaskRepository  extends CustomRepository<TodoTask, String> {

    @Query(value = "SELECT * FROM TODO_TASK T where (SELECT D.BRANCH_ID FROM MAS_DEPT D WHERE D.ID = T.INIT_DEPT_ID) in :branchIds",nativeQuery = true)
    List<TodoTask> findByDept(@Param("branchIds")List<String> branchIds);

    @Query(value = "SELECT * FROM TODO_TASK T where (SELECT D.BRANCH_ID FROM MAS_DEPT D WHERE D.ID = T.INIT_DEPT_ID) in :branchIds and t.aggregate_type = :aggregateType and t.description = :description",nativeQuery = true)
    List<TodoTask> findByDeptAndBusiness(@Param("branchIds")List<String> branchIds,@Param("aggregateType") String aggregateType,@Param("description") String description);



}
